package com.jjyd.crlp.domain.repository;

import com.jjyd.crlp.domain.entity.Dictionary;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DictionaryRepo extends JpaRepository<Dictionary, Integer> {

    /**
     * 模糊查询单词
     * @param search
     * @return
     */
    @Query("select dic from Dictionary dic where dic.remove=false and " +
            "(dic.originalLanguage like ?1 or dic.targetLanguage like ?1)")
    List<Dictionary> findByRemoveFalseAndLanguageLike(String search);


    List<Dictionary> findByRemoveFalseAndIdIn(List<Integer> idList);


    List<Dictionary> findByRemoveFalse();

}
